<template>
	<view>
		<view style="position: fixed;top:0;background: #F8F9FD;z-index: -2;width:100%;height:100vh;"></view>
		<view class="baseHt1">管理员</view>
		<view class="baseHt2">
			{{uInfo.phonenumber}}
		</view>
		<view class="baseHt1">员工</view>
		<view class="baseHt2" v-for="(item,index) in list" :key="index"
			@click="goPage('/pages/my/users/userDetail?id=' + item.userId)">
			{{item.name}}-{{item.phone}}
		</view>

		<div class="fix-bom">
			<view class="bottombtn" style="width: 100%;border-radius: 22px;"
				@click="goPage('/pages/my/users/addUsers')">
				新增员工</view>
		</div>
	</view>
</template>

<script>
	import {
		staffList
	} from '@/request/api.js'
	import {
		getUsercookie
	} from '@/utils/auth.js'
	export default {
		data() {
			return {
				uInfo: {},
				list: [],
			}
		},
		onLoad() {
			const res = getUsercookie()
			this.uInfo = res
		},
		onShow() {
			this.getList()
		},
		methods: {
			// getUsers() {
			// 	getUserList().then(res => {
			// 		console.log('users', res)
			// 		this.list = res.data
			// 	})
			// },
			getList() {
				staffList().then(res => {
					console.log('123', res)
					this.list = res.data
				})
			},
			goPage(e) {
				uni.navigateTo({
					url: e
				})
			},
		}
	}
</script>

<style scoped>
	.baseHt1 {
		height: 96rpx;
		line-height: 96rpx;
		padding: 0 24rpx;
		color: #63666B;
		font-weight: 500;
	}

	.baseHt2 {
		height: 92rpx;
		line-height: 92rpx;
		padding: 0 24rpx;
		background: #fff;
	}
</style>